<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateVideosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('videos', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_id')->comment('用户ID');
            $table->string('title')->comment('视频标题');
            $table->string('path')->comment('存储位置');
            $table->boolean('is_recommend')->default(0)->comment('是否已推荐');
            $table->unsignedInteger("weight")->default(0)->comment('排序权重');
            $table->unsignedInteger("likes_num")->default(0)->comment('点赞总数');
            $table->unsignedInteger("likes_num_fake")->default(0)->comment('点赞总数假数据');
            $table->unsignedInteger("review_num")->default(0)->comment('评论总数');
            $table->timestamp('deleted_at')->nullable();
            $table->timestamps();
        });

        Schema::create("images", function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title')->comment('图片标题');
            $table->tinyInteger('used_for')->default(0)->comment('引用类型');
            $table->unsignedBigInteger('used_id')->comment('引用对象ID');
            $table->string('path')->comment('存储位置');
            $table->integer('sort')->default(0)->comment('排序');
            $table->timestamp('deleted_at')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('videos');
        Schema::dropIfExists('images');
    }
}
